package uk.ac.tess.timemanagement.todolist;

import java.util.List;

import uk.ac.tess.timemanagement.R;
import android.app.ActionBar;
import android.os.Bundle;
import android.widget.ListView;

public class ToDoMain extends ToDoActionBar {

	private ToDoArrayAdapter listAdapter;
	
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.todo_main_layout);  
        
    	ActionBar actionBar = this.getActionBar();
		actionBar.setIcon(R.drawable.ic_navigation_home_2); 
		actionBar.setTitle("To Do List");
		//actionBar.setHomeButtonEnabled(true);  // Enables the logo to be clickable generating tht
		actionBar.setDisplayHomeAsUpEnabled(true); // display the back button
		//actionBar.setLogo(R.drawable.to_do_list);
    	
		/*getWindow().
        getDecorView().
        setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); */
        
        ListView mainListView = (ListView) findViewById( R.id.todo_main_listview);
		ToDoDatabaseHandler db = new ToDoDatabaseHandler(this.getApplicationContext());
		List<ToDoItem> items = db.getAllToDoItems();
		
		listAdapter = new ToDoArrayAdapter(this.getApplicationContext(), R.layout.todo_row, items);
        mainListView.setAdapter(listAdapter);
        
        

        
    }


}
